package org.jiuling.gaode.geocode.dto;

import org.jiuling.basics.validation.Assertions;
import org.jiuling.gaode.enums.ResponseFormatEnum;

/**
 * 地理编码参数数据传输对象
 * @author 紫灵
 * @date 2024年08月22日 15时50分03秒
 */
public class GeoCodeParamDto {

    /** 地址 */
    private String address;
    /** 城市 */
    private String city;
    /** 数字签名 */
    private String sig;
    /** 响应格式 */
    private ResponseFormatEnum output;
    /** 回调函数 */
    private String callback;

    public String getAddress() {
        return address;
    }

    public String getCity() {
        return city;
    }

    public String getSig() {
        return sig;
    }

    public ResponseFormatEnum getOutput() {
        return output;
    }

    public String getCallback() {
        return callback;
    }

    /**
     * 建造者
     * @return 建造者对象
     */
    public static Builder builder(){
        return new Builder();
    }

    /**
     * 建造者
     */
    public static class Builder {
        private final GeoCodeParamDto geoCodeParamDto;

        public Builder(){
            this.geoCodeParamDto = new GeoCodeParamDto();
        }

        public Builder addAddress(String address) {
            this.geoCodeParamDto.address = address;
            return this;
        }

        public Builder addCity(String city) {
            this.geoCodeParamDto.city = city;
            return this;
        }

        public Builder addSig(String sig) {
            this.geoCodeParamDto.sig = sig;
            return this;
        }

        public Builder addOutput(ResponseFormatEnum output) {
            this.geoCodeParamDto.output = output;
            return this;
        }

        public Builder addCallback(String callback) {
            this.geoCodeParamDto.callback = callback;
            return this;
        }

        public GeoCodeParamDto build() {
            Assertions.StringAssertions.isNotBlank("地址不能为空！", this.geoCodeParamDto.address);
            return this.geoCodeParamDto;
        }
    }
}
